<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>明星证件信息查询系统 🌟</title>
    <style>
        :root {
            --primary-color: #6a11cb;
            --secondary-color: #2575fc;
            --accent-color: #ff4d94;
            --text-color: #333;
            --light-color: #f8f9fa;
            --dark-color: #343a40;
            --success-color: #28a745;
            --error-color: #dc3545;
            --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            --transition: all 0.3s ease;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        body {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
            color: var(--text-color);
        }
        
        .container {
            background-color: white;
            border-radius: 15px;
            box-shadow: var(--shadow);
            width: 100%;
            max-width: 600px;
            padding: 35px;
            transition: var(--transition);
            transform: translateY(0);
            opacity: 1;
            position: relative;
            overflow: hidden;
        }
        
        .container::before {
            content: "";
            position: absolute;
            top: 0;
            right: 0;
            width: 250px;
            height: 250px;
            background: linear-gradient(45deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
            border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
            z-index: 0;
        }
        
        .container.hidden {
            transform: translateY(20px);
            opacity: 0;
        }
        
        h1 {
            text-align: center;
            margin-bottom: 25px;
            position: relative;
            z-index: 1;
            font-weight: 700;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
            font-size: 28px;
        }
        
        .title-gradient {
            background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            letter-spacing: 1px;
        }
        
        .search-box {
            display: flex;
            margin-bottom: 30px;
            position: relative;
            z-index: 1;
        }
        
        .search-input {
            flex: 1;
            padding: 18px 25px;
            border: 2px solid #eee;
            border-radius: 50px;
            font-size: 16px;
            outline: none;
            transition: var(--transition);
            box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
        }
        
        .search-input:focus {
            border-color: var(--accent-color);
            box-shadow: 0 0 0 4px rgba(106, 17, 203, 0.1);
        }
        
        .search-btn {
            position: absolute;
            right: 5px;
            top: 5px;
            bottom: 5px;
            background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
            color: white;
            border: none;
            border-radius: 50px;
            padding: 0 28px;
            cursor: pointer;
            font-weight: 600;
            transition: var(--transition);
            letter-spacing: 1px;
        }
        
        .search-btn:hover {
            transform: scale(1.05);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        }
        
        .result-container {
            background-color: var(--light-color);
            border-radius: 12px;
            transition: var(--transition);
            opacity: 0;
            height: 0;
            overflow: hidden;
            position: relative;
            z-index: 1;
            border: 1px solid rgba(0,0,0,0.05);
            box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
        }
        
        .result-container.show {
            opacity: 1;
            height: auto;
            padding: 30px;
            margin-bottom: 20px;
        }
        
        .result-title {
            font-size: 20px;
            font-weight: 700;
            margin-bottom: 20px;
            color: var(--primary-color);
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .result-content {
            display: grid;
            grid-template-columns: 110px 1fr;
            gap: 15px;
            margin-top: 15px;
        }
        
        .result-label {
            font-weight: 600;
            color: #555;
            opacity: 0.9;
            font-size: 15px;
        }
        
        .result-value {
            font-size: 16px;
        }
        
        .no-result {
            text-align: center;
            padding: 30px 20px;
            color: #666;
            font-size: 16px;
        }
        
        .suggestions {
            margin-top: 15px;
            font-size: 15px;
            color: #666;
            text-align: center;
            position: relative;
            z-index: 1;
        }
        
        .suggestion-tag {
            display: inline-block;
            background: linear-gradient(to right, rgba(106, 17, 203, 0.1), rgba(37, 117, 252, 0.1));
            padding: 7px 16px;
            border-radius: 50px;
            margin: 5px;
            cursor: pointer;
            transition: var(--transition);
            color: #555;
            border: 1px solid rgba(0,0,0,0.05);
            font-size: 14px;
        }
        
        .suggestion-tag:hover {
            background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
            color: white;
            transform: translateY(-3px);
            box-shadow: 0 5px 10px rgba(0,0,0,0.08);
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(15px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .fade-in {
            animation: fadeIn 0.5s ease forwards;
        }
        
        .emoji {
            font-size: 1.4em;
        }
        
        .age-badge {
            display: inline-block;
            background: linear-gradient(to right, var(--accent-color), #ff6b6b);
            color: white;
            padding: 4px 10px;
            border-radius: 50px;
            margin-left: 12px;
            font-size: 13px;
            font-weight: 600;
        }
        
        .loading {
            position: relative;
            display: inline-block;
            width: 24px;
            height: 24px;
            vertical-align: middle;
            margin-left: 10px;
        }
        
        .loading::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border: 3px solid rgba(106, 17, 203, 0.2);
            border-radius: 50%;
            border-top-color: var(--primary-color);
            animation: spin 1s linear infinite;
        }
        
        @keyframes spin {
            to { transform: rotate(360deg); }
        }
        
        .notification {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%) translateY(100px);
            background-color: var(--success-color);
            color: white;
            padding: 12px 25px;
            border-radius: 50px;
            opacity: 0;
            transition: all 0.4s ease;
            box-shadow: 0 5px 15px rgba(0,0,0,0.15);
        }
        
        .notification.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
        
        .notification.error {
            background-color: var(--error-color);
        }
        
        .count-indicator {
            position: absolute;
            top: 15px;
            right: 15px;
            background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
            color: white;
            padding: 5px 12px;
            border-radius: 50px;
            font-size: 14px;
            z-index: 1;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="count-indicator">已有<span id="starCount">18</span>位明星资料</div>
        <h1><span class="emoji">🔍</span> <span class="title-gradient">明星证件信息查询系统</span> <span class="emoji">🌟</span></h1>
        
        <div class="search-box">
            <input type="text" class="search-input" placeholder="请输入明星姓名..." id="searchInput">
            <button class="search-btn" id="searchBtn">搜索</button>
        </div>
        
        <div class="result-container" id="resultContainer">
            <!-- 结果将在这里动态显示 -->
        </div>
        
        <div class="suggestions">
            <div>热门明星推荐:</div>
            <div id="suggestionTags"></div>
        </div>
    </div>
    
    <div class="notification" id="notification"></div>

    <script>
        // 明星数据库 (新增了更多明星信息)
        const database = {
            "霍建华": { 
                id: "03316293",
                birthDate: "1979-12-26",
                docType: "台胞证",
                gender: "男",
                nationality: "中国台湾"
            },
            "田馥甄": { 
                id: "04943654",
                birthDate: "1983-03-30",
                docType: "台胞证",
                gender: "女",
                nationality: "中国台湾"
            },
            "彭于晏": { 
                id: "01944171",
                birthDate: "1982-03-24",
                docType: "台胞证",
                gender: "男",
                nationality: "中国台湾"
            },
            "陈嘉桦": { 
                id: "04843596",
                birthDate: "1981-06-18",
                docType: "台胞证",
                gender: "女",
                nationality: "中国台湾"
            },
            "赵又廷": { 
                id: "07561409",
                birthDate: "1984-09-25",
                docType: "台胞证",
                gender: "男",
                nationality: "中国台湾"
            },
            "周杰伦": { 
                id: "04306591",
                birthDate: "1979-01-18",
                docType: "台胞证",
                gender: "男",
                nationality: "中国台湾"
            },
            "林宥嘉": { 
                id: "00484287",
                birthDate: "1987-07-01",
                docType: "台胞证",
                gender: "男",
                nationality: "中国台湾"
            },
            "张信哲": { 
                id: "00257254",
                birthDate: "1967-03-26",
                docType: "台胞证",
                gender: "男",
                nationality: "中国台湾"
            },
            "吴奇隆": { 
                id: "00646628",
                birthDate: "1970-10-31",
                docType: "台胞证",
                gender: "男",
                nationality: "中国台湾"
            },
            "任言恺": { 
                id: "08366064",
                birthDate: "1984-02-27",
                docType: "台胞证",
                gender: "男",
                nationality: "中国台湾"
            },
            "炎亚纶": { 
                id: "06571520",
                birthDate: "1985-11-20",
                docType: "台胞证",
                gender: "男",
                nationality: "中国台湾"
            },
            "任家萱": { 
                id: "01909954",
                birthDate: "1981-10-31",
                docType: "台胞证",
                gender: "女",
                nationality: "中国台湾"
            },
            "蔡依林": { 
                id: "03154598",
                birthDate: "1980-09-15",
                docType: "台胞证",
                gender: "女",
                nationality: "中国台湾"
            },
            "陈乔恩": { 
                id: "04868770",
                birthDate: "1979-04-04",
                docType: "台胞证",
                gender: "女",
                nationality: "中国台湾"
            },
            "林心如": { 
                id: "02528108",
                birthDate: "1976-01-27",
                docType: "台胞证",
                gender: "女",
                nationality: "中国台湾"
            },
            "欧阳娜娜": { 
                id: "05420821",
                birthDate: "2000-06-15",
                docType: "台胞证",
                gender: "女",
                nationality: "中国台湾"
            },
            "陈妍希": { 
                id: "06579190",
                birthDate: "1983-05-31",
                docType: "台胞证",
                gender: "女",
                nationality: "中国台湾"
            },
            "陈楚河": { 
                id: "03315274",
                birthDate: "1978-05-09",
                docType: "台胞证",
                gender: "男",
                nationality: "中国台湾"
            },
            "刘德华": {
                id: "A1234567",
                birthDate: "1961-09-27",
                docType: "回乡证",
                gender: "男",
                nationality: "中国香港"
            },
            "杨幂": {
                id: "B9876543",
                birthDate: "1986-09-12",
                docType: "居民身份证",
                gender: "女",
                nationality: "中国"
            },
            "易烊千玺": {
                id: "20001128X",
                birthDate: "2000-11-28",
                docType: "居民身份证",
                gender: "男",
                nationality: "中国"
            },
            "黄子韬": {
                id: "G8765432",
                birthDate: "1993-05-02",
                docType: "护照",
                gender: "男",
                nationality: "中国"
            }
        };
        
        // 更新明星数量
        document.getElementById('starCount').textContent = Object.keys(database).length;
        
        // 随机emoji
        const emojis = ["✨", "🎉", "🔎", "📇", "🆔", "👤", "📋", "📑", "📊", "📈", "🎂", "🎁"];
        
        // 获取DOM元素
        const searchInput = document.getElementById('searchInput');
        const searchBtn = document.getElementById('searchBtn');
        const resultContainer = document.getElementById('resultContainer');
        const suggestionTags = document.getElementById('suggestionTags');
        const notification = document.getElementById('notification');
        
        // 计算年龄函数
        function calculateAge(birthDate) {
            const today = new Date();
            const birth = new Date(birthDate);
            let age = today.getFullYear() - birth.getFullYear();
            const monthDiff = today.getMonth() - birth.getMonth();
            
            if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) {
                age--;
            }
            
            return age;
        }
        
        // 格式化日期显示
        function formatDate(dateStr) {
            const date = new Date(dateStr);
            return `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日`;
        }
        
        // 显示通知
        function showNotification(message, isError = false) {
            notification.textContent = message;
            notification.className = "notification show";
            if (isError) notification.classList.add("error");
            
            setTimeout(() => {
                notification.classList.remove("show");
            }, 3000);
        }
        
        // 初始化建议标签
        function initSuggestions() {
            const names = Object.keys(database);
            // 随机选择8个名字作为建议
            const shuffled = names.sort(() => 0.5 - Math.random());
            const selected = shuffled.slice(0, 8);
            
            selected.forEach(name => {
                const tag = document.createElement('span');
                tag.className = 'suggestion-tag';
                tag.textContent = name;
                tag.addEventListener('click', () => {
                    searchInput.value = name;
                    search();
                    // 自动滚动到结果区域
                    resultContainer.scrollIntoView({behavior: "smooth", block: "nearest"});
                });
                suggestionTags.appendChild(tag);
            });
        }
        
        // 搜索函数
        function search() {
            const name = searchInput.value.trim();
            
            // 移除结果容器显示状态
            resultContainer.classList.remove('show');
            // 添加加载中状态
            searchBtn.innerHTML = '加载中 <span class="loading"></span>';
            
            // 模拟网络请求延迟
            setTimeout(() => {
                if (name === '') {
                    showNoResult('请输入要查询的明星姓名');
                    searchBtn.innerHTML = '搜索';
                    return;
                }
                
                // 尝试寻找匹配（不区分大小写）
                const normalizedSearch = name.toLowerCase();
                const foundName = Object.keys(database).find(key => 
                    key.toLowerCase().includes(normalizedSearch)
                );
                
                if (foundName) {
                    // 显示成功通知
                    showNotification(`找到了 "${foundName}" 的信息`);
                    showResult(foundName, database[foundName]);
                } else {
                    // 显示错误通知
                    showNotification(`未找到 "${name}" 的信息`, true);
                    showNoResult(`没有找到 "${name}" 的信息`);
                }
                
                searchBtn.innerHTML = '搜索';
            }, 800);
        }
        
        // 显示结果
        function showResult(name, data) {
            const randomEmoji = emojis[Math.floor(Math.random() * emojis.length)];
            const age = calculateAge(data.birthDate);
            const formattedDate = formatDate(data.birthDate);
            
            resultContainer.innerHTML = `
                <div class="result-title fade-in">${randomEmoji} 查询结果</div>
                <div class="result-content fade-in" style="animation-delay: 0.1s">
                    <div class="result-label">姓名:</div>
                    <div class="result-value">${name}</div>
                    
                    <div class="result-label">性别:</div>
                    <div class="result-value">${data.gender || '未知'}</div>
                    
                    <div class="result-label">国籍:</div>
                    <div class="result-value">${data.nationality || '未知'}</div>
                    
                    <div class="result-label">证件类型:</div>
                    <div class="result-value">${data.docType}</div>
                    
                    <div class="result-label">证件号码:</div>
                    <div class="result-value">${data.id}</div>
                    
                    <div class="result-label">出生日期:</div>
                    <div class="result-value">${formattedDate} <span class="age-badge">${age}岁</span></div>
                </div>
            `;
            
            // 显示结果容器
            setTimeout(() => {
                resultContainer.classList.add('show');
            }, 50);
        }
        
        // 显示无结果
        function showNoResult(message) {
            resultContainer.innerHTML = `
                <div class="no-result fade-in">${message}</div>
            `;
            
            // 显示结果容器
            setTimeout(() => {
                resultContainer.classList.add('show');
            }, 50);
        }
        
        // 事件监听
        searchBtn.addEventListener('click', search);
        searchInput.addEventListener('keypress', (e) => {
            if (e.key === 'Enter') {
                search();
            }
        });
        
        // 页面加载动画
        window.addEventListener('load', () => {
            setTimeout(() => {
                document.querySelector('.container').classList.remove('hidden');
            }, 100);
            
            initSuggestions();
            
            // 提示用户
            showNotification('系统已就绪，请输入明星姓名查询');
        });
    </script>
</body>
</html>
